package com.qiwenshare.file.vo.file;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;



/**
 * @author MAC
 * @version 1.0
 * @description: TODO
 *
 */
@Data
public class SearchFileVO {
    private String userFileId;
    private String fileName;
    private String filePath;
    private String extendName;
    private Long fileSize;
    private String fileUrl;
    private Map<String, List<String>> highLight;
    private Integer isDir;

    public static SearchFileVO valueOf(FileListVO fileListVO, String fileName) {
        SearchFileVO searchFileVO = new SearchFileVO();
        searchFileVO.setUserFileId(fileListVO.getUserFileId());
        searchFileVO.setFileName(fileListVO.getFileName());
        searchFileVO.setFilePath(fileListVO.getFilePath());
        searchFileVO.setExtendName(fileListVO.getExtendName());
        searchFileVO.setFileSize(fileListVO.getFileSize());
        searchFileVO.setFileUrl(fileListVO.getFileUrl());
        searchFileVO.setHighLight(null);
        searchFileVO.setIsDir(fileListVO.getIsDir());

        HashMap<String, List<String>> highLightMap = new HashMap<>();
        highLightMap.put("fileName", List.of(fileListVO.getFileName()));
        searchFileVO.setHighLight(highLightMap);
        return searchFileVO;
    }
}
